{include file="public/layout"/}
<body class="laytp-container">
<div class="layui-card">
    <div class="layui-card-body">
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-card layui-col-md12">
                    <div class="layui-card-header">
                        <div class="layui-card-header">
                            <div class="layui-tab layui-tab-brief">
                                <ul class="layui-tab-title">
                                    {foreach $group_list as $group}
                                    <li {if $inc_type==$group['inc_type']}class="layui-this"{/if} onclick="location.href='{$group['url']}'">{$group.name}</li>
                                    {/foreach}
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="layui-card-body" pad15>
                        <div class="layui-form" lay-filter="">
                            <div class="layui-tab layui-tab-brief" lay-filter="mytab">
                                <!--********注册协议************-->
                                <div class="layui-tab-item layui-show">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" style="width:130px">用户注册协议：</label>
                                        <div class="layui-input-inline" style="width:300px">
                                            <input type="radio" name="xieyi_status" title="开启" value="1" {if $config['xieyi_status']==1}checked{/if} />
                                            <input type="radio" name="xieyi_status" title="关闭" value="0" {if $config['xieyi_status']==0}checked{/if} />
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" style="width:130px">注册协议名称：</label>
                                        <div class="layui-input-inline" style="width:300px">
                                            <input type="text" name="xieyi_name" value="{$config['xieyi_name']}" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux"></div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" style="width:130px">注册协议内容：</label>
                                        <div class="layui-input-inline" style="width:500px">
                                            <script id="xycontent" name="xieyi_content" type="text/plain" style="width:100%;height:400px">{$config.xieyi_content}
                                            </script>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" style="width:130px">隐私政策名称：</label>
                                        <div class="layui-input-inline" style="width:300px">
                                            <input type="text" name="yinsi_name" value="{$config['yinsi_name']}" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux"></div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" style="width:130px">隐私政策内容：</label>
                                        <div class="layui-input-inline" style="width:500px">
                                            <script id="xycontent2" name="yinsi_content" type="text/plain" style="width:100%;height:400px">{$config.yinsi_content}
                                            </script>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" style="width:130px">商家入驻协议：</label>
                                        <div class="layui-input-inline" style="width:300px">
                                            <input type="text" name="supply_xieyi_name" value="{$config['supply_xieyi_name']}" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux"></div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" style="width:130px">商家入驻协议内容：</label>
                                        <div class="layui-input-inline" style="width:500px">
                                            <script id="xycontent3" name="supply_xieyi_content" type="text/plain" style="width:100%;height:400px">{$config.supply_xieyi_content}
                                            </script>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block" style="margin-left:175px;">
                                    <button class="layui-btn" lay-submit lay-filter="formsubmit">提 交</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        </div>
    </div>
</div>
<!--以下是在线编辑器 代码 -->
<script type="text/javascript" charset="utf-8" src="/static/Ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/Ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/Ueditor/lang/zh-cn/zh-cn.js"></script>
<!--以上是在线编辑器 代码  end-->
<script>
    var ueditor = UE.getEditor('xycontent', {imageScaleEnabled: false});
    var ueditor2 = UE.getEditor('xycontent2', {imageScaleEnabled: false});
    var ueditor3 = UE.getEditor('xycontent3', {imageScaleEnabled: false});
    layui.use(function () {
        layui.form.on('submit(formsubmit)', function (obj) {
            var field = obj.field
            field['xieyi_content'] = ueditor.getContent();
            field['yinsi_content'] = ueditor2.getContent();
            field['supply_xieyi_content'] = ueditor3.getContent();
            //哪个选项卡 用于刷新后保持
            var tabindex = 0;
            $('.layui-tab-title>li').each(function (i, v) {
                if ($(this).hasClass('layui-this')) {
                    tabindex = i;
                    console.log(i)
                    return false;
                }
            })
            field.tabindex = tabindex;
            field.inc_type = 'xieyi';
            var index = layer.load();
            $.post('{:url("handle")}', field, function (data) {
                layer.close(index);
                if(data.status==1){
                    dialog(data.msg, data.status, data.url);
                }
            })
        })

    })



</script>
</body>
</html>